#Programmer: Rory Carmichael
#Purpose: generate makeflow for aligning files in a given directory
#Usage: weaver.py rc-align-groups.pl group_dir

import shlex, subprocess
from weaver.nest import Nest
from weaver.function import PythonFunction, Function
from array import array
import re
import sys

if (len(CurrentScript().arguments) != 1) :
	print "Usage: weaver.py rc-align-groups.pl group_dir\n"
	sys.exist(1)

align = Function('muscle', cmd_format = '{executable} -in {inputs} -out {outputs}')

files = Glob(str(CurrentScript().arguments[0]) + "/*.fasta")

for i in files:
	aln_out = str(i) + ".aln"
	align(inputs=i, outputs=aln_out)
